/*
 * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.util.concurrent.TimeUnit;

/**
 * <p>Project: javase - Ex1
 * <p>Powered by webrx On 2021-12-23 17:57:08
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Ex1 {
    public static void main(String[] args) {
        new Thread(() -> {
            while (true) {
                try {
                    TimeUnit.SECONDS.sleep(2);
                    System.out.println(Thread.activeCount());
                } catch (Exception e) {
                    e.printStackTrace();
                }
                String t = String.format("%tF %<tT", System.currentTimeMillis());
                if (t.equals("2021-12-23 18:00:00")) {
                    System.out.println("下课了");
                    break;
                }
            }
        }, "tt").start();

        var t2 = new Thread(() -> {
            while (true) ;
        }, "t1");
        t2.start();

        var t3 = new Thread(() -> {
            while (true) ;
        }, "t3");
        t3.start();

    }
}
